# 用来处理表格数据  数据分析
# Series:一维数组， k v，竖着的数组
import numpy as np
import pandas as pd

# list
s = pd.Series([1, 2, 3, 4])
print(s)
print(s[2])
print(s[:2])
print(s[2:])

s = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'], name='demo')
print(s)
print(s['c'])

print(s.axes)
print(s.dtype)
print(s.empty)
print(s.ndim)  # 维度
print(s.size)
print(s.values)
print(s.index)
print(s.head(3))
print(s.tail(3))

s = pd.Series(['C ', ' Python', 'java', 'go', 'javascript', '11', np.nan])
print(s.str.lower())
print(s.str.len())

print(pd.Series(5, index=[0, 1, 2, 3]))

arr = np.array([1, 2, 3, 4])
print(pd.Series(arr))

print(pd.Series(5, index=[0, 1, 2, 3]))

print(pd.Series(np.random.randn(5)))

# dict
dict = {'a': "Google", 'b': "Run", 'c': "Wiki"}
print(pd.Series(dict))
